<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title></title>
    <link rel="stylesheet" href="../../../static/layui/css/layui.css" th:href="@{/layui/css/layui.css}">
</head>
<body>
<form class="layui-form" style="margin-top: 50px;">
    <input type="hidden" name="id" th:value="${httpCode.id}">
    <div class="layui-form-item">
        <label class="layui-form-label">状态码</label>
        <div class="layui-input-inline">
            <input type="text" name="code" th:value="${httpCode.code}" required lay-verify="required" placeholder="请输入状态码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">标志</label>
        <div class="layui-input-inline">
            <input type="text" name="flag" th:value="${httpCode.flag}" required lay-verify="required" placeholder="请输入标志" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">描述</label>
        <div class="layui-input-inline">
            <textarea class="layui-textarea" th:text="${httpCode.description}" name="description" placeholder="请输入描述"></textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="go">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

<script src="../../../static/layui/layui.js" th:src="@{/layui/layui.js}"></script>
<script>
    layui.use(['layer','form'],function () {
        var layer = layui.layer,
            form = layui.form,
            $ = layui.jquery;

        //监听提交
        form.on('submit(go)', function(data){

            $.ajax({
                url:"/util/httpStatusCode/update",
                type:"POST",
                data:data.field,
                success:function (e) {
                    if(e.success){
                        window.parent.location.href='/util/httpStatusCode/manage'
                    }
                },
                dataType:"json"
            });
            return false;
        });

    });
</script>
</body>
</html>